

[#-------------- INCLUDE AND ASSIGN PART --------------]


[#-- FIXME the into is now the area's def --]
[#assign intro = def]
[#assign pageModel = model.root]
[#assign pageDef = pageModel.definition]
[#assign pageType = pageDef.subcategory ! pageDef.category]

[#-- Assigns: Template Intro Definitions --]
[#assign showAuthorDate = intro.showAuthorDate]
[#assign showTextFeatures = intro.showTextFeatures]
[#assign showAbstract = intro.showAbstract]
[#assign showTOC = intro.showTOC]
[#assign showCategories = intro.showCategories]
[#assign showImage = intro.showImage]

[#-- Assigns: Get Content --]
[#assign title = content.title!content.@name]
[#assign kicker = content.kicker!]
[#assign date = content.date!]
[#assign author = content.author!]
[#assign location = content.location!]
[#assign abstract = content.abstract!]
[#assign categories = pageModel.categories!]
[#assign imageModel = pageModel.imageModel!]

[#-- Assigns: Is Content Available --]
[#assign hasTitle = title?has_content]
[#assign hasKicker = kicker?has_content]
[#assign hasDate = date?has_content]
[#assign hasAuthor = author?has_content]
[#assign hasLocation = location?has_content]
[#assign hasAbstract = abstract?has_content]
[#assign hasCategories = categories?has_content]
[#assign hasExtraTemplate = extraTemplate?has_content]
[#assign hasImage = imageModel.image?has_content]

[#-- Assigns: Macro for Item iteration --]
[#macro assignItemValues item]
    [#-- Assigns: Get Content from List Item--]
    [#assign itemName = item.@name]
    [#assign itemDisplayName = item.displayName!itemName]
    [#assign itemLink = pageModel.getCategoryLink(itemName)!]
[/#macro]
[#-------------- RENDERING PART --------------]

[#-- Rendering: Main Area Intro --]
[#if intro.divID??]
    <div id="${intro.divID}">
[/#if]

[#if intro.dialog??]
    [#-- FIXME the former label was newLabel="${i18n['${pageType}.editLabel.header']}" --]
    [#-- Info: The mainAreaIntro displays and edits page content. --]
[/#if]

[#if hasTitle]
    <h1>
        [#if hasKicker]<em>${kicker}</em>[/#if]
        ${title}
    </h1>
[/#if]

[#if (showAuthorDate && (hasDate || hasAuthor || hasLocation)) || showTextFeatures || (showCategories && hasCategories)]
    <div class="text-meta" role="contentinfo">
        [#if showAuthorDate]
            [#if hasDate || hasAuthor || hasLocation]
                <ul class="text-data">
                    [#if hasDate]
                        <li class="date">${date?date?string.medium}</li>
                    [/#if]
                    [#if hasAuthor]
                        <li class="author">${author}</li>
                    [/#if]
                    [#if hasLocation]
                        <li class="location">${location}</li>
                    [/#if]
                </ul>
            [/#if]
        [/#if]

        [#if showTextFeatures]
            [#include "/templating-kit/pages/content/textFeatures.ftl"]
        [/#if]

        [#if showCategories]
            [#if hasCategories]
                <dl>
                    <dt>${i18n['mainAreaIntro.category.label']}</dt>
                    [#list categories as item]
                        [#-- Macro: Item Assigns --]
                        [@assignItemValues item=item /]
                        <dd><a href="${itemLink}" >${itemDisplayName}</a></dd>
                    [/#list]
                </dl>
            [/#if]
        [/#if]
    </div><!-- end text-meta -->
[/#if]

[@cms.area name="infoBlock" content=content/]

[#if showImage]
    [#if hasImage]
        <img class="${imageModel.imageClass}" src="${imageModel.image.link}" alt="${imageModel.image.caption!"Image "+content.title!content.@name}" />
    [/#if]
[/#if]

[#if showAbstract]
    [#if hasAbstract]
        [#if !intro.divID?has_content]
            [#assign abstractClass = 'class="intro"']
        [/#if]
        <p ${abstractClass!}>${abstract}</p>
    [/#if]
[/#if]

[#if showTOC]
    [#include "/templating-kit/pages/content/contentTable.ftl" ]
[/#if]

[#if intro.divID??]
    </div>
[/#if]
